<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

// Route::get('/', function () {
//     return view('home.welcome');
// });
Route::get('/',  'Home\HomeController@index');
Auth::routes();

// Route::get('shop/{id}', 'Home\ShopController@index');
// Route::get('shop/{id}/cateId/{cateId?}', 'Home\ShopController@index');
Route::get('product/{id}', 'Home\ShopController@productDetail');
Route::post('product/search', 'Home\ShopController@searchProduct');
Route::get('categories/{id?}/{order?}', 'Home\CategoryController@index');


// background route rules
Route::group(['prefix' => 'admin', 'middleware' => ['adminFilter'] ], function(){
    Route::resource('/index', 'Admin\IndexController');
    # 商品管理
    Route::resource('/product', 'Admin\ProductController');
    Route::get('/product/delete/{id}', 'Admin\ProductController@destroy');
    Route::get('/product/photo/{id}', 'Admin\ProductController@photoList');
    Route::post('/product/photo/{id}', 'Admin\ProductController@photoList');
    # 图片上传
    Route::post('/photo/upload', 'Admin\PhotoController@upload');
    Route::post('/photo/crop', 'Admin\PhotoController@crop');
    # 分类设置
    Route::resource('/categories', 'Admin\CategoriesController');
    Route::get('/categories/delete/{id}', 'Admin\CategoriesController@delete');
    # 店铺设置
    Route::resource('/shop', 'Admin\ShopController');
    Route::get('/shop/face/create', 'Admin\ShopController@faceCreate');
});
